#include "StdAfx.h"
#include "CdiLocation.h"

CdiLocation::CdiLocation() 
: m_x( 0.0f ), m_y( 0.0f ), m_z( 0.0f ), m_incrDelta( 0.0f )
{
}

CdiLocation::~CdiLocation(void)
{
  m_x = 0.0f; 
  m_y = 0.0f; 
  m_z = 0.0f;
}

CdiLocation::CdiLocation(float xLocation, float yLocation, float zLocation)
: m_x( xLocation ), m_y( yLocation ), m_z( zLocation ), m_incrDelta( 0.0f )
{
}

CdiLocation::CdiLocation( CdiLocation& Location ) 
{
  m_x = Location.m_x;
  m_y = Location.m_y;
  m_z = Location.m_z;
}

// Operators
bool CdiLocation::operator==( CdiLocation& next )
{
  return (m_x == next.m_x && 
    m_y == next.m_y &&
    m_z == next.m_z );
}

// Operators
CdiLocation& CdiLocation::operator=( CdiLocation& next )
{
  m_x *= next.m_x;
  m_y *= next.m_y;
  m_z *= next.m_z;

  return *this;
}

// Operators
CdiLocation CdiLocation::operator*( CdiLocation& next )
{
  CdiLocation ret( *this );
  ret.m_x *= next.m_x;
  ret.m_y *= next.m_y;
  ret.m_z *= next.m_z;

  return ret;
}

// Operators
CdiLocation CdiLocation::operator-( CdiLocation& next )
{
  CdiLocation ret( *this );
  ret.m_x -= next.m_x;
  ret.m_y -= next.m_y;
  ret.m_z -= next.m_z;

  return ret;
}

// Operators
CdiLocation CdiLocation::operator+( CdiLocation& next )
{
  CdiLocation ret( *this );
  ret.m_x += next.m_x;
  ret.m_y += next.m_y;
  ret.m_z += next.m_z;

  return ret;
}


CdiLocation CdiLocation::Distance( CdiLocation& object )
{
  return Distance( object.m_x, object.m_y, object.m_z );
}

CdiLocation CdiLocation::Distance( float x, float y, float z )
{
  CdiLocation ret( m_x-x, m_y-y, m_z-z);
  return ret;
}

void CdiLocation::Move( CdiLocation& delta ) 
{
  m_x += delta.m_x;
  m_y += delta.m_y;
  m_z += delta.m_z;
}